package com.sc.nft.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.vo.WriteOffRecordVO;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.PackageRecord;
import com.sc.nft.mapper.PackageRecordMapper;
import  com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.Date;

/**
 * 套餐记录表(sc_package_record)数据DAO
 *
 * @author zxy
 * @since 2023-10-14 02:01:22
 * @description 汇付相关
 */
@Slf4j
@Repository
public class PackageRecordDao extends ServiceImpl<PackageRecordMapper, PackageRecord> {

    public Page<WriteOffRecordVO> getPage(Page page, Long packageId, String userTel, String operationUserTel, Date startRecordTime, Date endRecordTime) {
        return baseMapper.getPage(page, packageId, userTel, operationUserTel, startRecordTime, endRecordTime);
    }


    public PackageRecord getByCollectionUuid(String collectionUuid){
        return lambdaQuery().eq(PackageRecord::getCollectionUuid,collectionUuid).one();
    }


    public Integer writeOffCount(Long packageId) {
        return lambdaQuery().eq(PackageRecord::getPackageId,packageId).count();
    }
}